<?
		include("dbconn.inc");
		include("dbfuc.inc");
		include("session.inc");		
		$randam= rand(5, 100000);
		$_SESSION["session_pointtransfer_random"]=$randam;
		$adminuser=$_SESSION["adminuser"];
		$adminid=$_SESSION["adminid"];
		$admindb=$_SESSION["admindb"];
		
	if(session_is_registered("admindb") )
	{
		if(($adminuser!="") && (($adminid!="") || ($adminid!=0)))
		{	
	
			$sql="";$slno="";$chk="";$id="";
			$count=0;$flag=0;
		
			$count=$HTTP_POST_VARS["cnt"];
			$coupon_userid=$HTTP_POST_VARS["coupon_userid"];	
?>
<html>
<head>
<title>coupons</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body>
<? include "allheader.php"  ?>	

<?
	for($i=1;$i<=$count;$i=$i+1)
	{
			
		$chk=$HTTP_POST_VARS["chk".$i];
					
		if($chk=="")
		$chk="N";
		if($chk=="Y")
		{
			$flag=$flag+1;
			$id=$HTTP_POST_VARS["id".$i];
			$slno=$HTTP_POST_VARS["slno".$i];
			$sqlupdatecoupon="update mlm_coupon_details set n_id='$coupon_userid' where c_status='N' and n_slno='$slno' ";
			mysql_query($sqlupdatecoupon);
		}
	}
	if($flag>0)
	{

?>
		<br><br><br><br><br><br>
		<table width="50%" border="1" align="center" cellpadding="4" cellspacing="3" bordercolor="#5B7109" bgcolor="#F8FDE3">
		  <tr> 
			<td>
			<div align="center">
			<strong>
			<font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-serif">
			<? echo $flag ?> Coupons Alloted
			</font>
			</strong>
			</div>			
			</td>
		  </tr>
		</table>
<?
	}
	else
	{
?>
		<br><br><br><br><br><br>
		<table width="50%" border="1" align="center" cellpadding="4" cellspacing="3" bordercolor="#5B7109" bgcolor="#F8FDE3">
		  <tr> 
			<td>
			<div align="center">
			<strong>
			<font color="#FF0000" size="2" face="Verdana, Arial, Helvetica, sans-serif">No Coupons Aloted.....</font>
			</strong>
			</div>
			</td>
		  </tr>
		</table>
<?
	}	
?>
</body>
</html>
<?
	}
	}
	else
	{
		$errormsg="Your session is expeired. Please login again.";
		header("location: index.php?error=$errormsg");
	}

?>	
